package des.yordan.mihaylov;

import java.util.Comparator;
import java.util.PriorityQueue;

/**
 * @author Yordan Mihaylov
 * @version 2011/05/15
 */

public class SortableQueue<T> {

	private PriorityQueue<T> eventQueue;

	public SortableQueue(Comparator<T> comparator) {
		eventQueue = new PriorityQueue<T>(20, comparator);
	}

	public void addElement(T e) {
		eventQueue.offer(e);
	}

	// returns NULL if the queue is empty
	public T getNextElement() {
		return eventQueue.poll();
	}

	public int getSize() {
		return eventQueue.size();
	}

	public PriorityQueue<T> getEventQueue() {
		return eventQueue;
	}
}
